﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="CompareReport.aspx.cs" Inherits="ExamAnalysis.Reports.CompareReport" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        var submitValue = function (grid, hiddenFormat, format) {
            hiddenFormat.setValue(format);
            grid.submitData(false, { isUpload: true });
        };
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <ext:Hidden ID="FormatType" runat="server" />
    <ext:GridPanel 
        ID="GridPanel" 
        SortableColumns="true"
        runat="server" 
        Title="超级管理员对比整体通用分析报表" 
        ColumnLines="true"
        Height="350">
        <Store>
            <ext:Store ID="GridStore" runat="server" OnSubmitData="Store_Submit">
                <Model>
                    <ext:Model runat="server">
                        <Fields>
                            <ext:ModelField Name="ClassID" Type="Int" />
                            <ext:ModelField Name="ClassName" Type="String" />
                            <ext:ModelField Name="ExamID" Type="Int" />
                            <ext:ModelField Name="ExamName" Type="String" />
                            <ext:ModelField Name="Score" Type="Float" />
                            <ext:ModelField Name="Rank" Type="Int" />
                            <ext:ModelField Name="CalendarID" Type="Int" />
                            <ext:ModelField Name="CalendarName" Type="String" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
        </Store>
        <TopBar>
            <ext:Toolbar runat="server">
                <Items>
                    <ext:Label runat="server" Text="选择班级：" />
                    <ext:ComboBox 
                        ID="ClassList" 
                        Width="200" 
                        runat="server"
                        DisplayField="ClassAliasName" 
                        ValueField="ClassID">
                        <Store>
                            <ext:Store runat="server" ID="ClassStore">
                                <Model>
                                    <ext:Model runat="server" IDProperty="ClassID">
                                        <Fields>
                                            <ext:ModelField Name="ClassAliasName" />
                                            <ext:ModelField Name="ClassID" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                    </ext:ComboBox>
                    <ext:Label Text="选择科目：" runat="server" />
                    <ext:ComboBox ID="CourseList" Width="150" runat="server" OnDirectChange="CourseList_Changed" DisplayField="CourseName" 
                        ValueField="CourseID">
                        <Store>
                            <ext:Store runat="server" ID="CourseStore">
                                <Model>
                                    <ext:Model runat="server" IDProperty="CourseID">
                                        <Fields>
                                            <ext:ModelField Name="CourseID" />
                                            <ext:ModelField Name="CourseName" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                    </ext:ComboBox>
                    <ext:Label Text="选择考试：" runat="server" />
                    <ext:DropDownField ID="ExamList" Width="250" Editable="false" runat="server" Text="全部">
                        <Component>
                             <ext:GridPanel ID="ExamGrid" Width="400" SortableColumns="true" HideHeaders="false" runat="server" ForceFit="false">
                                <Store>
                                    <ext:Store ID="ExamStore" runat="server">
                                        <Model>
                                            <ext:Model runat="server" IDProperty="ExamID">
                                                <Fields>
                                                    <ext:ModelField Name="ExamID" />
                                                    <ext:ModelField Name="ExamName" />
                                                    <ext:ModelField Name="CalendarID" />
                                                    <ext:ModelField Name="DisplayName" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                        <Sorters>
                                            <ext:DataSorter Property="ExamID" Direction="DESC" />
                                        </Sorters>
                                    </ext:Store>                                   
                                </Store>
                                <ColumnModel runat="server">
                                    <Columns>
                                        <ext:Column runat="server" Text="学期" Width="180" DataIndex="DisplayName" />
                                        <ext:Column runat="server" Text="考试名称" Width="200" DataIndex="ExamName" />
                                    </Columns>
                                </ColumnModel>
                                <View>
                                    <ext:GridView runat="server" LoadMask="true" />
                                </View>
                                <SelectionModel>
                                    <ext:RowSelectionModel runat="server" Mode="Multi" />
                                </SelectionModel>
                                <Listeners>
                                    <SelectionChange Handler="this.dropDownField.setValue('自定义', false);" />
                                </Listeners>
                            </ext:GridPanel>
                        </Component>
                    </ext:DropDownField>
                    <ext:Button Text="生成" Icon="Accept" runat="server">
                        <DirectEvents>
                            <Click OnEvent="SubmitButton_Click" Timeout="60000"  />
                        </DirectEvents>
                    </ext:Button>
                    <ext:Button Text="保存" AutoPostBack="true" Icon="Disk" runat="server">
                        <Listeners>
                            <Click Handler="submitValue(#{GridPanel}, #{FormatType}, 'xls');" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button Text="打印" Icon="Printer" runat="server">
                        <Listeners>
                            <Click Handler="javascript:window.print();" />
                        </Listeners>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <ColumnModel runat="server">
            <Columns>
                <ext:Column runat="server" Text="班级" DataIndex="ClassName" Flex="1" Sortable="false" />
                <ext:Column runat="server" Text="学期" DataIndex="CalendarName" Flex="1" Sortable="false" />
                <ext:Column runat="server" Text="考试名称" DataIndex="ExamName" Flex="1" Sortable="false" />
                <ext:Column runat="server" Text="分数" DataIndex="Score" Flex="1" Sortable="false" />
                <ext:Column runat="server" Text="名次" DataIndex="Rank" Flex="1" Sortable="false" />
            </Columns>
        </ColumnModel>
        <BottomBar>
            <ext:StatusBar runat="server">
                <Items>
                    <ext:Chart 
                        ID="GridChart" 
                        runat="server"             
                        Shadow="true"
                        height="120" Width="500"
                        StandardTheme="Category1"
                        Animate="true">
                        <Store>
                            <ext:Store ID="GridChartStore"
                                runat="server" 
                                AutoDataBind="true">                           
                                <Model>
                                    <ext:Model runat="server">
                                        <Fields>
                                            <ext:ModelField Name="ClassID" Type="Int" />
                                            <ext:ModelField Name="ClassName" Type="String" />
                                            <ext:ModelField Name="ExamID" Type="Int" />
                                            <ext:ModelField Name="ExamName" Type="String" />
                                            <ext:ModelField Name="Score" Type="Float" />
                                            <ext:ModelField Name="Rank" Type="Int" />
                                            <ext:ModelField Name="CalendarID" Type="Int" />
                                            <ext:ModelField Name="CalendarName" Type="String" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                        <Axes>
                            <ext:NumericAxis                             
                                Fields="Score"
                                Title="分数"
                                MinorTickSteps="1"
                                Minimum="40">
                                <GridConfig>
                                    <Odd Opacity="1" Fill="#ddd" Stroke="#bbb" StrokeWidth="0.5" />
                                </GridConfig>
                            </ext:NumericAxis>
                            <ext:CategoryAxis 
                                Position="Bottom"
                                Fields="ExamName"
                                Title="考试">
                            </ext:CategoryAxis>
                        </Axes>
                        <Series>
                            <ext:LineSeries Axis="Left" XField="ExamID" YField="Score">
                                <HighlightConfig Size="7" Radius="7" />
                                <MarkerConfig Type="Cross" Size="4" Radius="4" StrokeWidth="0" />
                            </ext:LineSeries>
                        </Series>
                    </ext:Chart>
                    <ext:ToolbarFill runat="server" />
                </Items>
            </ext:StatusBar>
        </BottomBar>
    </ext:GridPanel>
</asp:Content>
